﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WPFByCoreApp
{
    public class TestDecimal
    {

        public static string Test()
        {
            string str = "";

            decimal[] vals = { 1.111111m, 1.1111111111111111111111111111m };

            str += string.Format("{0,31}  {1,10:X8}{2,10:X8}{3,10:X8}{4,10:X8}\n",
                            "Argument", "Bits[3]", "Bits[2]", "Bits[1]", "Bits[0]");
            str += string.Format("{0,31}  {1,10:X8}{2,10:X8}{3,10:X8}{4,10:X8}\n",
                           "--------", "-------", "-------", "-------", "-------");

            foreach (decimal val in vals)
            {
                int[] bits = decimal.GetBits(val);

                str += string.Format("{0,31}  {1,10:X8}{2,10:X8}{3,10:X8}{4,10:X8}\n", val, bits[3], bits[2], bits[1], bits[0]);
            }

            var input = 1.1111111111111111111111111111m;
            for (int i = 1; i < 10; i++)
            {
                decimal output = input * (decimal)i;
                str += string.Format("{0,31}   {1}\n", "", output);
            }

            decimal a = (1.1111111111111111111111111111m * 9m);

            return str;
        }
    }
}
